from django.db import models
import time

# Create your models here.
class Orders(models.Model):
    user_id = models.PositiveIntegerField()
    departid = models.PositiveIntegerField()
    order_number = models.CharField(max_length=128)
    status = models.PositiveIntegerField()
    pay_status = models.PositiveIntegerField()
    pay_time = models.IntegerField()
    amount = models.PositiveIntegerField()
    logistics_name = models.CharField(max_length=255)
    salt = models.CharField(max_length=50)
    logistics_mobile = models.CharField(max_length=11)
    logistics_address = models.CharField(max_length=255)
    logistics_company = models.CharField(max_length=255)
    logistics_type = models.PositiveIntegerField()
    logistics_company_code = models.CharField(max_length=255)
    logistics_number = models.CharField(max_length=255)
    postcode = models.PositiveIntegerField()
    customer_company = models.CharField(max_length=255)
    customer_name = models.CharField(max_length=255)
    customer_position = models.CharField(max_length=255)
    logistics_time = models.PositiveIntegerField()
    confirm_time = models.PositiveIntegerField()
    remark = models.CharField(max_length=255)
    ctime = models.PositiveIntegerField(default=time.time())
    utime = models.PositiveIntegerField(default=time.time())

    class Meta:
        app_label = 'orders'
        managed = False
        db_table = 'pf_orders'


class OrdersProduct(models.Model):
    user_id = models.PositiveIntegerField()
    order_number = models.CharField(max_length=255)
    product_id = models.PositiveIntegerField()
    product_type = models.PositiveIntegerField()
    product_name = models.CharField(max_length=255)
    product_num = models.PositiveIntegerField()
    product_price = models.PositiveIntegerField()
    product_thumb = models.CharField(max_length=255)
    ctime = models.PositiveIntegerField(default=time.time())
    mtime = models.PositiveIntegerField(default=time.time())

    class Meta:
        app_label = 'orders'
        managed = False
        db_table = 'pf_orders_product'

class LogisticsCompany(models.Model):
    name = models.CharField(max_length=255)
    code = models.CharField(max_length=255)
    ctime = models.PositiveIntegerField(default=time.time())

    class Meta:
        managed = False
        db_table = 'pf_logistics_company'
